<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        var obj = {
            name:"lixu",
            age:21,
            sex:"female"
        }
        var arr = [1,2,5,10];
        //如果对象的属性值是变量，只能用[]的方式读取属性值
        for(let key in obj){
            console.log(obj[key]);

        }
        for(let key in arr){
            //得到数组的下标
            // console.log(key);
            //得到数组的值
            console.log(arr[key]);

        }
        //直接取到值
        // for(let value of arr){
        //     console.log(value);
        // }
    </script>
</body>
</html>